package com.company.admin.controller.job.social;

import com.company.admin.common.annotations.VisitAble;
import com.company.admin.common.result.ResultResponse;
import com.company.admin.req.job.social.SocialJobAddRequest;
import com.company.admin.req.job.social.SocialJobDeletRequest;
import com.company.admin.req.job.social.SocialJobListRequest;
import com.company.admin.req.job.social.SocialJobModifyRequest;
import com.company.admin.resp.job.social.SocialJobListResponse;
import com.company.admin.service.job.social.SocialJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @program: myProject
 * @description: ${description}
 * @author: zhaochenglin
 * @create: 2019-03-03 15:56
 **/
@RequestMapping("/job/social")
@Controller
public class SocialJobController {

    @Autowired
    private SocialJobService socialJobService;


    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public ResultResponse<String> add(@RequestBody SocialJobAddRequest socialJobAddRequest){
        socialJobService.add(socialJobAddRequest);
        return ResultResponse.onSuccess("success",null);
    }


    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    @ResponseBody
    public ResultResponse<String> modify(@RequestBody SocialJobModifyRequest request){
        socialJobService.modify(request);
        return ResultResponse.onSuccess("success", null);
    }

    @VisitAble
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    public ResultResponse<SocialJobListResponse> list(@RequestBody SocialJobListRequest request){
        return ResultResponse.onSuccess(socialJobService.list(request), null);
    }

    @ResponseBody
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public ResultResponse<String> delete(@RequestBody SocialJobDeletRequest request){
        socialJobService.delete(request);
        return ResultResponse.onSuccess("success",null);
    }
}
